From: | Gregory Roberts II |
Date: | 02 Aug 99 at 04:08:45 |
Subject: | Re: Re: (no subject) |
From: Gregory Roberts II <gregr@en.com>
On Sat, 31 Jul 1999, Tim Hanson wrote:
> From: Tim Hanson <msinister@connectfree.co.uk>
>
> Gregory Roberts II wrote this on 31-Jul-99 at 12:36:34
> Hi Gregory
>
> -> A shared library is just that: shared by many processes. Therefore, it
> -> doesn't have the context that dos.library needs to operate.
>
> I`ve got another question though. Can library functions call other
> libraries? If so how do they know that they are open? or can library
> functions open the library themselves?
>
Can libraries call other libraries? Sure! You generally open them
yourself during initialization and stuff the library pointer into your own
library base. Then you use the library pointer from your library base
whenever you want to call a function from that library. Just close it
when your library is being expunged.
(hint: how else would you be able to call AmigaOS functions from a shared
library. :-) I seem to remember one of the AmigaOS libraries having a
pointer to another library base in it, though I could be mistaken about
this)
This is really easy to do from assembly. Please don't ask me how to get
your C compiler to actually *USE* the library pointer to call functions
though. This is very compiler specific and I don't think I've tried it in
C before.
Good luck!
Greg